tooltip.ts ➔ createTooltip   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 13
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 13
rs 9.75
c 0
b 0
f 0
cc 1
1
import { NodeSelection } from '../../components/types';
2
import { Colors } from '../../utils/AppConsts';
3
import { selectTooltip } from '../../utils/helpers/Selectors';
4
5
export function createTooltip(svgContainer: NodeSelection<SVGGElement>) {
6
    const tooltipElement = svgContainer
7
        .append('g')
8
        .attr('id', 'tooltip')
9
        .attr('data-test-id', 'tooltip')
10
        .style('opacity', 0);
11
    tooltipElement
12
        .append('rect')
13
        .attr('fill', Colors.BLACK)
14
        .attr('rx', 5)
15
        .attr('ry', 5);
16
    tooltipElement.append('text').attr('fill', Colors.WHITE);
17
}
18
19
export function showTooltip() {
20
    selectTooltip().attr('visibility', 'visible');
21
}
22
23
export function hideTooltip() {
24
    selectTooltip().attr('visibility', 'hidden');
25
}
26